/**
 *商户常用js
 **/

//显示错误信息
function showErrorMsg(msg)
{
	msgDiv = document.createElement("div");
	msgDiv.style.cssText = "";
	
}

//检查输入的页码是否是数字
function fucCheckNUM(NUM)
{
	 var i,j,strTemp;
	 strTemp="0123456789";
	 if ( NUM.length== 0)
		return 0
	 for (i=0;i<NUM.length;i++)
	 {
		  j=strTemp.indexOf(NUM.charAt(i)); 
		  if (j==-1)
		  {
		  //说明有字符不是数字
		   return 0;
		  }
	 }
	 //说明是数字
	 return 1;
}

function goPage(objForm)
{
	if (objForm.page.value=="") {
		alert("请输入页数！");
		objForm.page.select();
		objForm.page.focus();
		return false;
	}
	if (!fucCheckNUM(objForm.page.value)) {
		alert("您的输入不正确，请输入数字！");
		objForm.page.select();
		objForm.page.focus();
		return false;
	}
	if (parseInt(objForm.page.value) > parseInt(objForm.page.maxpage)) {
		alert("您的输入不正确，超过了最大页数，请重新输入！");
		objForm.page.select();
		objForm.page.focus();
		return false;
	}
	return true;
}

/**
 * 添加评论时，选择的评价类型
 */
function fnSelectAppraise(iVal)
{
	JQ("#apprIcon>li").each(function(){
		if (this.value==iVal){
			this.className = "bg4";
			JQ("#appraise").val(iVal);
		}
		else {
			this.className = "";
		}
	});
	return false;
}

function fnResetComment()
{
	JQ("#up").html("");
	JQ("#pic_input").html("上传图片：<input name='uppic[]' id='file_uppic' type='file' class='ly'><input name='button' type='button' class='sou' onClick='increaceUp();' value=' + '>");
	JQ("#content").val("");
	clearAppraise();
}


//取消评价类型的选择
function clearAppraise()
{
	JQ("#appraise").val("");
	JQ("#apprIcon>li").each(function(){
		this.className = "";
	});
}
//添加评论的检查
function addcomment()
{
	if (JQ("#appraise").val()=='') {
		alert("请选择看法!");
		return false;
	}
	if(JQ('#content').val() == ''){
		alert('评论内容不能为空!');
		return false;
	} 
	if(JQ('#code').val() == ''){
		alert('验证码不能为空!');
		return false;
	} 
	JQ("#Load").html("<img src='/images/load_top.gif' width='20'>&nbsp;&nbsp;<input name='submit' type='submit'  disabled class='fba' value='发 表' />");
	return true;
}
var count = 1

//增加菜单
function addMenu(price,name,id,sunit){
	var flg = "false";
	var str = $("#menu_id").val();
	var s="";
	str = str.split(",");
	$.post("home_menu_click.php", {id:id,type:"click"});
	for(i=0;i<str.length-1;i++){
		if(str[i]==id){
			flg = "true";
			$("#number_"+id).val(parseInt($("#number_"+id).val())+1);
			//增加价格
			$("#menu_price").html(parseInt($("#menu_price").html())+price);
			break;
		}
	}
	
	if(flg=="false"){
		str = $("#menu_id").val();
		str+=id+",";
		$("#menu_id").val(str);
		//增加价格
		$("#menu_price").html(parseInt($("#menu_price").html())+price);
		$("#up").prepend("<ul id='menu_"+id+"'>"+
						 "<li class='store_r15_1 f14' onclick='javescript:removeMenu("+id+","+price+");' style='cursor:hand'>×</li>"+
						 "<li class='store_r15_2'>"+name+"</li>"+
						 "<li class='store_r15_3'>"+
						 "<input name='"+id+"' id='number_"+id+"' type='text' value='1' size='1' maxlength='2' class='store_input2' /></li>"+
						 "<li class='store_r15_4'>￥<label id='sum_"+id+"'>"+price+"元/"+sunit+"</label></li></ul>");
	}
}
//删除菜单
function removeMenu(id,price){
	var str = $("#menu_id").val();
	str = str.split(",");
	var s="";
	for(i=0;i<str.length-1;i++){
		if(str[i]==id){
			continue;
		}else{
			s+=str[i]+",";
		}
	}
	
	//alert(s);
	$("#menu_id").val(s);	
	$number = parseInt(parseInt($("#menu_price").html())-price*parseInt($("#number_"+id).val()));
	if($number==0){
		$("#menu_price").html("0");
	}else{
		$("#menu_price").html($number);
	}
	$("#menu_"+id).remove();
}
//计算价格预算
function sumMenu(){
	var num=0;
	$("#up input").each(function(i){
		if(this.value<=0){
			this.value=1;
		}
		num=num+parseFloat($("#sum_"+this.name).html())*parseFloat(this.value);
	});
	$("#menu_price").html(num);
}
//打印预算
function pintMenu(){
	var str="";
	$("#up input").each(function(i){
		str=str+parseFloat(this.name)+","+parseFloat(this.value)+"|";
	});
	$("#msg").val(str);
}
//验证聚会邀请信息
function invitedParty(){
	if($("#my_name").val()==''){
		alert("您的名称不能为空！");	
		$("#my_name").focus();
		return false;
	}
	if($("#mail_1").val()==''){
		alert("电子邮件不能为空 ！");	
		$("#mail_1").focus();
		return false;
	}
	if($("#title").val()==''){
		alert("标题不能为空！");	
		$("#title").focus();
		return false;
	}
	if($("#year").val()==''){
		alert("聚会年份不能为空！");	
		$("#year").focus();
		return false;
	}
	/*if($("#month").val()==''){
		alert("聚会月份不能为空！");	
		$("#month").focus();
		return false;
	}
	if($("#day").val()==''){
		alert("聚会日期不能为空！");	
		$("#day").focus();
		return false;
	}*/
	if($("#hour").val()==''){
		alert("聚会时间不能为空！");	
		$("#hour").focus();
		return false;
	}   
	var   re=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;    
	if(!re.test($("#mail_1").val()))   
	{   
	  alert("电子邮件地址格式不正确!");   
	  $("#mail_1").focus();
	  return false;
	}
	if($("#mail_2").val()!=''){
		if(!re.test($("#mail_2").val()))   
		{   
		  alert("电子邮件地址格式不正确!");   
		  $("#mail_2").focus();
		  return false;
		}	
	}
	if($("#mail_3").val()!=''){
		if(!re.test($("#mail_3").val()))   
		{   
		  alert("电子邮件地址格式不正确!");   
		  $("#mail_3").focus();
		  return false;
		}	
	}
	if($("#mail_4").val()!=''){
		if(!re.test($("#mail_4").val()))   
		{   
		  alert("电子邮件地址格式不正确!");   
		  $("#mail_4").focus();
		  return false;
		}	
	}
	if($("#mail_5").val()!=''){
		if(!re.test($("#mail_5").val()))   
		{   
		  alert("电子邮件地址格式不正确!");   
		  $("#mail_5").focus();
		  return false;
		}	
	}
	/*if(isNaN($("#year").val())){
		alert("聚会年份只能是数字！");	
		$("#year").focus();
		return false;
	}
	if(isNaN($("#month").val()) || ($("#month").val()>12) || ($("#month").val()<1)){
		alert("聚会月份只能是1-12的数字！");	
		$("#month").focus();
		return false;
	}
	if(isNaN($("#day").val()) || ($("#day").val()>31) || ($("#day").val()<1)){
		alert("聚会日期只能是1-31的数字！");	
		$("#day").focus();
		return false;
	}*/
	if(isNaN($("#hour").val()) || ($("#hour").val()>24) || ($("#hour").val()<1)){
		alert("聚会时间只能是1-24的数字！");	
		$("#hour").focus();
		return false;
	}   
	return true;
}
//增加多个上传
function increaceUp()
{
	count =parseInt(document.getElementById('pic_count').value);
	//up = $('up');
	//updiv = document.getElementById('up');
	var iDiv = document.createElement("div");
	//iDiv.style.display = 'block';
	//最多可以增加到3个
	if(count <= 3){	
		var input_file = document.createElement("input");
		input_file.type = "file";
		input_file.id ="input_increace"+count;
		input_file.name = "uppic[]";			
		input_file.className = 'ly';
		input_file.style.cssText = "margin-left:73px;";
		var remove_btn = document.createElement("input");
		remove_btn.type = "button";
		remove_btn.id = "remove_increace"+count;
		remove_btn.value = "移除";
		remove_btn.className = 'sou';
		remove_btn.onclick = function(){
			this.parentNode.parentNode.removeChild(this.parentNode);	
			count -= 1;	
			document.getElementById('pic_count').value = count;		
		}
		
		iDiv.appendChild(input_file);
		iDiv.appendChild(remove_btn);
		count +=1;
		document.getElementById('pic_count').value = count;		
	}
	else
	{
		alert("对不起，最多只能上传四张图片");
	}
	
	up.appendChild(iDiv);	
}

function DoFresh(){
	var t=new Date();
	JQ("#Fresh > img").attr("src", "/script/code.php?number="+t);
}

var chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];

function generateMixed(n) {
    var res = "";
    for(var i = 0; i < n ; i ++) {
        var id = Math.ceil(Math.random()*35);
        res += chars[id];
    }
    return res;
}

function ShowFresh(){
	DoFresh();
}
function fnCode()
{	
	JQ("#Load").html("<input name='submit2' type='submit' class='fba' value='发 表' />");
	JQ("#DoFresh").attr("src","/script/code.php");
	JQ("#code").val("");
}

function fnUpDown(sid,flag)
{
	Ajax_UpDown(sid,flag);
}


/**
 * 推荐店铺页面使用JS函数
 *
 */
function next()
{
		document.forms['recommend_map'].action="recommend.php?act=confirm";
		document.forms['recommend_map'].submit();

}
function lon_lat()
{
	if(document.recommend_map.longitude.value=='' || document.recommend_map.latitude.value=='' ){
		alert("请在地图上将您推荐的商户位置标注！");
		return false;
	}
	return true;
	
}
function fnShowMap()
{
	$("#mapLoadingDiv").css({display: "none"});
	$("#mapFrame").css({display: "block"});
}

function CheckUpload(s,maxsize)
{
	//是否为图片格式
	var isPic = 0;
	//var Ext = [["jpg"]];
	var Ext = [["gif"],["jpg"],["bmp"],["png"]];
	if (s.replace( /^\s*/ ," " ).replace( /\s*$/ ,"" ) == "") {
		return false;
	}

	ext = s.substring(s.lastIndexOf('.')+1,s.length).toLowerCase();
	for(var i = 0;i<Ext.length;i++)
	{
		if(ext == Ext[i]){
			isPic = 1;
		}
	}
	if(!isPic){
		//alert("只能上传(jpg)格式的图片");
		alert("只能上传(gif,jpg,bmp,png)格式的图片");
		document.getElementById("BTN1").disabled = true;
		document.getElementById("BTN2").disabled = true;
		return false;
	}
	document.getElementById("BTN1").disabled = false;
	document.getElementById("BTN2").disabled = false;
}
function fnnext()
{
	if(fnRecommendValidate()){
			document.forms['recommend_form'].action="recommend.php?act=map";
			document.forms['recommend_form'].submit();
	}

}
function fnRecommendValidate()
{
	if(document.recommend_form.name.value==''){
		alert("请填写贵店(公司)名称！");
		return false;
	}
	if(document.recommend_form.area.value==''){
		alert("请填写贵店所在城市！");
		return false;
	}
		if(document.recommend_form.address.value==''){
		alert("请填写地址！");
		return false;
	}
	if(document.recommend_form.tel.value==''){
		alert("请填写电话！");
		return false;
	}
	if(document.recommend_form.name.value.length>9){
		alert("贵店(公司)名称限9个字以内！");
		return false;
	}
	if(document.recommend_form.reason.value.length>2000){
		alert("推荐此商户的理由限制为2000字！");
		return false;
	}
	return true;
}
function fnsave()
{
	if(fnRecommendValidate()){
		document.forms['recommend_form'].action="recommend.php?act=suc";
		document.forms['recommend_form'].submit();
	}

}
function del_pic(num)
{
	Ajax_DelPic(num);
	return false;

}
function check_name()
{
	Ajax_CheckName(document.recommend_form.name.value,document.recommend_form.area.value );
	return false;

}

function fnIsUseful(i,iId,sId)
{	
	var s;
	if(i==1)
		s="有";
	if(i==2)
		s="无";
	if(confirm("此照片真的对你'"+s+"用'吗？")){
	$.post("home.php", { act: "isuseful", use:i,p_id:iId,sid:sId}, function(data){ if(i==1){ $("#useful_"+iId).html(""); $("#useful_"+iId).append(data);alert('评价有用成功!');}else if(i==2){ $("#useless_"+iId).html(""); $("#useless_"+iId).append(data);alert('评价无用成功!');} } );
	}
}


function fnUploadPicture()
{
	SB_show('上传图片', '#SB_inline?height=180&width=380&inlineId=uploadloading');
	SB_unbindClose();
	return true;
}

function appendDiv(s,sid,uid)
{
	
	if(s==0){
	SB_remove();
	window.location.href="?act=pic_list&sid="+sid+"&uid="+uid;
	}else{
	$("#timeNums").html(s);
	s--;
	setTimeout("appendDiv("+s+","+sid+","+uid+")",1000);
	}
}
function fnPicFinish(i,s,sid,uid){
	SB_showContent('<div class="store_tcnr"><ul class="f14">已经成功上传<font class="red" id="picNums">'+i+'</font>张图片，<font id="timeNums">'+s+'</font>秒后系统将自动返回图片列表</ul><div class="tr mr40"><a href="?act=pic_list&sid='+sid+'&uid='+uid+'"  onclick="SB_remove();"><font class="red1">查看图片</font></a> <a href="?act=uploadpic&sid='+sid+'"  onclick="SB_remove();"><font class="red1">继续上传</font></a></div></div>', 'reload');
	window.setTimeout("appendDiv("+s+","+sid+","+uid+")", 1000);
}

function appendTopStoreTime(s,sid)
{
	if(s==0){
	SB_remove();
	window.location.href="home.php?sid="+sid;
	}else{
	$("#topStoreTime").html(s);
	s--;
	setTimeout("appendTopStoreTime("+s+","+sid+")",1000);
	}
}



function fnTopStore(sid,storename){

	$.post("home.php", { sid: sid, act: "topCheck" }, function(data){ 
	SB_show('顶上首页', 'ajax_show.php?type=showTopStore&storename='+encodeURI(storename)+'&sid='+sid+'&nums='+data+'&height=180&width=380');
	SB_unbindClose();
	} );

	window.setTimeout("appendTopStoreTime(4,"+sid+")", 1000);
}

function fnAddMemory(sid,mid){$.post("home.php", { act: "addmemory", sid:sid,mid:mid}, function(data){ alert(data); $.post("home.php", { act: "updateMemory", sid:sid}, function(data){ $("#store_memory").html(data); } );} );}

function showMenu(menuID)
{
	if ($("#"+menuID).css("display") != "block") {
			$("#"+menuID).css("display","block")
			$("#img_"+menuID).attr("src","/css/store/images/store_icon17.gif")
		}else {
			$("#"+menuID).css("display","none")
			$("#img_"+menuID).attr("src","/css/store/images/store_icon18.gif")
		}
}
function fnLoadComment()
{   
	$("#show_comment").load("ajax_show.php", {type:"showcomment", store_id: sStoreId});
	$("#taste").val("");
	$("#cricum").val("");
	$("#serve").val("");
	$("#menu").val("");
	$("#average").val("");
	$("#content").html("");
	$("#tag").val("");
	DoFresh();
	$("#code").val("");
	//fnCode();
}
function fnShowComment(sSort)
{
	$("#show_comment").load("ajax_show.php", {type:"showcomment", store_id: sStoreId,sort:sSort});
}
//周边商户
function fnShowRound(obj)
{
	//$("#storeround").load("ajax_show.php", {type:"showSround", store_id: sStoreId});
	for(i=1;i<=10;i++)
	{		
		if(obj==i){			
			$("#b_"+i).css("display","block");			
					
		}else{		
			$("#b_"+i).css("display","none");	

		}	
	}
}
function fnCommentPage(sPage)
{
	$("#show_comment").load("ajax_show.php", {type:"showcomment", store_id: sStoreId,sPage:sPage});
}


function fnAddFavorite()
{
	if (isMemberLogin=="true") {
		SB_show("收藏店铺", "#SB_inline?inlineId=confirm&height=180&width=380");
	}else{
		SB_show("收藏店铺", "#SB_inline?inlineId=login_1&height=180&width=380");
	}
	return false;
}

function setStore_VPV_Style(p)
{
	for(var k=1;k<=3;k++) {
		if(p==3)
			$("#allPic").css("display","block");
		else
			$("#allPic").css("display","none");

		if(p!=k)
			$("#storeIndex"+k).addClass("b_two");
		else
			$("#storeIndex"+k).removeClass("b_two");

		if(p==k)
			$("#jkcon"+k).css("display", "block");
		else
			$("#jkcon"+k).css("display", "none");
	}
}
//新改版添加
function setStore_video_Style(p)
{
	for(var k=1;k<=3;k++) {
		if(p==3)
			$("#allPic").css("display","block");
		else
			$("#allPic").css("display","none");

		if(p!=k)
			$("#storeIndex"+k).removeClass("VideoNavon");
		else
			$("#storeIndex"+k).addClass("VideoNavon");

		if(p==k)
			$("#jkcon"+k).css("display", "block");
		else
			$("#jkcon"+k).css("display", "none");
	}
}
function setStore_stroemsg_Style(p) {
   
	for(var k=1;k<=4;k++) {
		if(p==4)
			$("#allPic").css("display","block");
		else
			$("#allPic").css("display","none");

		if(p!=k)
			if(k==2 || k==4)

				$("#astore"+k).removeClass("Infor_t2on");
			else
				$("#astore"+k).removeClass("Infor_ton");
		else
			if(k==2 || k==4)
				$("#astore"+k).addClass("Infor_t2on");
			else
				$("#astore"+k).addClass("Infor_ton");

		if(p==k)
			$("#stormsg_"+k).css("display", "block");
		else
			$("#stormsg_"+k).css("display", "none");
	}
}
//验证提交评论
function fnLoadStoreComment(){
	$("#show_comment").load("ajax_show.php", {type:"StoreComment", store_id: sStoreId,page:page});
	$("#content").html("");
	$("#tag").val("");
	DoFresh();
	$("#code").val("");
}

//提交评论
function fnSaveComment()
{
//	if (isMemberLogin=="true") {
		Ajax_SaveComment(xajax.getFormValues('subCom'));
//	}else{
//		SB_show("提交评论", "#SB_inline?inlineId=login_1&height=180&width=380");
//	}	
	return false;
}
function Ajax_fnLoadStore(storename,storeid){
	$.post("LoginStore.php", { storename: storename}, function(data){ 
		if(data==0){
			SB_show('商户登录', 'ajax_show.php?type=LodStore&height=180&width=380');
		}else if(data==1){
			location.href="admin.php";
		}else{
			SB_show('商户管理', "ajax_show.php?type=ErStore&ladstoreid="+storeid+"&nowstoreid="+data+"&height=200&width=410");
		}													  
	} );
}
//发送给手机视频
function Ajax_fnSendPhone(Vid,StoreId){

	SB_show('免费发送本店视频到手机', "ajax_show.php?type=SendPhone&storeid="+StoreId+"&vid="+Vid+"&height=200&width=410");

}
//验证商户登录
function fnStoreLogin(flg)
{
	var ret = true;
	if(!flg){
		if (JQ("#StoreName").val()=="") {
			JQ("#StoreNameMessage").html("<font color='red'>*16字符内</font>");
			ret = false;
		}
		if (JQ("#StorePassword").val()=="") {
			JQ("#StorePassMessage").html("<font color='red'>*6-12字符</font>");
			ret = false;
		}
	}
	bAutoLogin = false;
	if (ret==true) {
		JQ.post( "/ajax_show.php", {type:"storeLogined", name:JQ("#StoreName").val(), pass:JQ("#StorePassword").val(), auto:JQ("#auto_login").val()}, function(data){
			if (data=="") {
				location.href="/admin.php";
			} else {
				JQ("#StoreLoginMessage").html("<font color='red'>"+data+",请重新输入!</font>");
				JQ("#StoreLoginMessage").css({display:"block"})
			}
		}, "html");
	}
	return false;
}
//验证手机发送
function fnSendPhone(flg)
{
	var ret = true;
	if(!flg){
		if (JQ("#phone").val()=="") {
			JQ("#PhoneNameMessage").html("<font color='red'>手机号不能为空!</font>");
			ret = false;
		}
		if (JQ("#phone").val()=="") {
			JQ("#PhoneNameMessage").html("<font color='red'>手机号填写不正确!</font>");
			ret = false;
		}
		if(!fucCheckNUM(JQ("#phone").val()))
		{
			JQ("#PhoneNameMessage").html("<font color='red'>手机号填写不正确!</font>");
			ret = false;
		}
		if(JQ("#phone").val().length != 11)
		{
			JQ("#PhoneNameMessage").html("<font color='red'>手机号位数填写不正确!</font>");
			ret = false;
		}

	}
	bAutoLogin = false;
	if (ret==true) {
		JQ.post( "/ajax_show.php", {type:"storeSendPhone", phone:JQ("#phone").val(),store_id:JQ("#store_id").val(),vid:JQ("#vid").val()}, function(data){
			if (data=="small") {
				JQ("#StoreLoginMessage").html("<font color='red'>未发送成功，请重新输入!</font>");
				JQ("#StoreLoginMessage").css({display:"block"})
			} else {
				SB_showContent('<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"><tr align="center" ><td width="24%" colspan="3"><p class="sendph">发送成功</p><p>已经把<b>'+JQ("#store_name").val()+'</b>视频</p><p>发送到'+JQ("#phone").val()+'手机上</p><p>欢迎再次使用该功能,请收到短信后</p><p>点击网址链接，进入观看本店视频</p></td></tr></table>', 'reload');
			}
		}, "html");
	}
	return false;
}
function showStoreDes(num){
	if(num==1){
		JQ("#StoreDesc1").css({display:"none"});
		JQ("#StoreDesc2").css({display:"block"});
	}else{
		JQ("#StoreDesc1").css({display:"block"});
		JQ("#StoreDesc2").css({display:"none"});
	}
}
function showNormalDes(num){
	if(num==1){
		JQ("#content2").css({display:"none"});
		JQ("#content3").css({display:"block"});
	}else{
		JQ("#content2").css({display:"block"});
		JQ("#content3").css({display:"none"});
	}
}
function fnFirstHideDiv(i)
{
	if (JQ("#tcindex").css("display") != "block"){
		JQ("#tcindex").css("display", "block");	
	}else{
		JQ("#tcindex").css("display", "none");
	}
}
function fnSendVideo(){
	if (JQ("#tcindex2").css("display") != "block"){
		JQ("#tcindex2").css("display", "block");
		JQ("#tcindex2").css("left", 400+"px");
		JQ("#tcindex2").css("top",  680+"px");
	}else{
		JQ("#tcindex2").css("display", "none");
	}
}
function fnMsnSendVideo(){
	if (JQ("#tcindex2").css("display") != "block"){
		JQ("#tcindex2").css("display", "block");
		JQ("#tcindex2").css("left", 380+"px");
		JQ("#tcindex2").css("top",  500+"px");
	}else{
		JQ("#tcindex2").css("display", "none");
	}
}
function fnSendChain(){
	if (JQ("#tcindex2").css("display") != "block"){
		JQ("#tcindex2").css("display", "block");
		JQ("#tcindex2").css("left", 580+"px");
		JQ("#tcindex2").css("top",  550+"px");
	}else{
		JQ("#tcindex2").css("display", "none");
	}
}
function fnShowNormal(){
	if (JQ("#tcindex").css("display") != "block"){
		JQ("#tcindex").css("display", "block");
		JQ("#tcindex").css("left", 210+"px");
		JQ("#tcindex").css("top",  660+"px");
	}else{
		JQ("#tcindex").css("display", "none");
	}
}
//连锁店视频切换
function showChain(i){
	if(i==1){
		JQ("#showtv").css("display","block");
		JQ("#about").css("display","none");
	}else if(i==2){
		JQ("#showtv").css("display","none");
		JQ("#about").css("display","block");
	}
}
/**
 * 显示评论Tag
 *
 * @param module  所属模块
 */
function fnCommentTag()
{
	//if (bXmlLoad==false && tagModule!="") {
		JQ("#CommentTagDiv").css({display:"block"});
		//JQ("#hotTag").load("/tag/"+tagModule+"/hot.html");
	//}
}
/**
 * 评论Tag的添加
 *
 * @param textObj 添加Tag的文本框的ID值
 * @param tagObj  要添加的Tag内容
 */
function fnAddTag(tagObj)
{	
	var tagText   = "tag";
	var tagTitle = tagObj.innerText;
	var tag = JQ("#"+tagText).val();
	if (tag!='') {
		tag = tag + ',' + tagTitle;
	}
	else {
		tag = tagTitle;
	}
	JQ("#"+tagText).val(tag);
}
/**
 * 显示评论Menu
 *
 * @param module  所属模块
 */
function fnCommentMenu()
{
	//if (bXmlLoad==false && tagModule!="") {
		JQ("#CommentMenuDiv").css({display:"block"});
		//JQ("#hotTag").load("/tag/"+tagModule+"/hot.html");
	//}
}
/**
 * 评论Menu的添加
 *
 * @param textObj 添加Tag的文本框的ID值
 * @param tagObj  要添加的Tag内容
 */
function fnAddMenu(tagObj)
{	
	var tagText   = "menu";
	var tagTitle = tagObj.innerText;
	var tag = JQ("#"+tagText).val();
	if (tag!='') {
		tag = tag + ',' + tagTitle;
	}
	else {
		tag = tagTitle;
	}
	JQ("#"+tagText).val(tag);
}
//发送给好友
function fnMail()
{
	var xml = xajax.getFormValues('mailForm');
	//fnShowLoading('正在发送，请稍候...');
	//SB_showContent("<div  class=\"gray\"><ul><li><b class=\"f14\">"'正在发送，请稍候...'"</b></li></ul></div>", true);
	Ajax_SaveMail(xml);
	return false;
}
//评论投票
//function fnCommentPoll(commId,poll)
//{
//	if (isMemberLogin=="true") {
//		Ajax_CommentPoll(commId,poll);
//	}else{
//		SB_show("评论投票", "#SB_inline?inlineId=login_1&height=180&width=380");
//	}
//	return false;
//}

//添加评论投票
function fnAddPoll()
{
	var xml = xajax.getFormValues('pollForm');
	Ajax_AddPoll(xml);
	return false;
}
//删除评论投票
function fnDelPoll()
{
	var xml = xajax.getFormValues('pollForm');
	Ajax_DelPoll(xml);
	return false;
}

/**
 * 显示评论Tag提示
 *
 * @param module  所属模块
 */
function fnCommentTagShow()
{
	JQ('#tooltip').html(JQ('#biaoqian').html());
	JQ('#tooltip').css("display", "block");
}

/**
 * 隐藏评论Tag提示
 *
 * @param module  所属模块
 */
function fnCommentTagHide()
{
	JQ('#tooltip').css("display", "none");
}
//评论回复
function fnrecomment(cid,store_id)
{
    SB_show('评论回复','ajax_show.php?type=recomment&cid='+cid+'&store_id='+store_id+'&height=154&width=504');
}
//纠错
function fnfeedback(store_id)
{
    SB_show('信息纠错','ajax_show.php?type=feedback&store_id='+store_id+'&height=320&width=620');
}
//上传图片
function fnpicupload(store_id)
{
    SB_show('图片上传','ajax_show.php?type=picupload&store_id='+store_id+'&height=400&width=730');
}
//发送给朋友
function fnsendfriend(name,store_id,cid)
{
    SB_show("您正在将 "+name+" 发送给您的朋友",'ajax_show.php?type=sendfriend&store_id='+store_id+'&id='+cid+'&height=320&width=620');
}
//评论回复提交处理
function afnReComment()
{   
	var xml = xajax.getFormValues('asubCom');
	Ajax_ReComment(xml);

}
//信息纠错提交处理
function afnfeedback()
{   
	var xml = xajax.getFormValues('feedback');
	Ajax_FeedBack(xml);

}
//图片上传提交处理
function afnpicupload()
{   
	var xml = xajax.getFormValues('picupload');
	Ajax_PicUpload(xml);

}
//发送给朋友提交处理
function afnsendfriend()
{   
	var xml = xajax.getFormValues('sendfriend');
	Ajax_SendFriend(xml);

}
function change360(url){
	$("#storeIndex1").addClass("b_two");
	$("#storeIndex2").removeClass("b_two");
	$("#storeIndex3").addClass("b_two");
	JQ("#jkcon1").css("display", "none");
	JQ("#jkcon2").css("display", "block");
	JQ("#jkcon3").css("display", "none");
	JQ("#tv").html("请稍等......");
	JQ("#tv").html("<iframe src="+url+" width='480' height='397' frameborder='0' scrolling='no'></iframe>");
}
function changeVideo(storeId,storeVid){
	$("#storeIndex1").removeClass("b_two");
	$("#storeIndex2").addClass("b_two");
	$("#storeIndex3").addClass("b_two");
	JQ("#jkcon1").css("display", "block");
	JQ("#jkcon2").css("display", "none");
	JQ("#jkcon3").css("display", "none");
	JQ("#changetv").html("请稍等......");
	$.post("ajax_show.php", { type: "changVideo", vid: storeVid,storeid:storeId},function(data){ $("#changetv").html(data); } );
}
function ychange360(url){
	$("#storeIndex1").removeClass("VideoNavon");
	$("#storeIndex2").addClass("VideoNavon");
	$("#storeIndex3").removeClass("VideoNavon");
	JQ("#jkcon1").css("display", "none");
	JQ("#jkcon2").css("display", "block");
	JQ("#jkcon3").css("display", "none");
	JQ("#tv").html("请稍等......");
	JQ("#tv").html("<iframe src="+url+" width='480' height='397' frameborder='0' scrolling='no'></iframe>");
}
function ychangeVideo(storeId,storeVid){
	$("#storeIndex1").addClass("VideoNavon");
	$("#storeIndex2").removeClass("VideoNavon");
	$("#storeIndex3").removeClass("VideoNavon");
	JQ("#jkcon1").css("display", "block");
	JQ("#jkcon2").css("display", "none");
	JQ("#jkcon3").css("display", "none");
	JQ("#changetv").html("请稍等......");
	$.post("ajax_show.php", { type: "changVideo", vid: storeVid,storeid:storeId},function(data){ $("#changetv").html(data); } );
}
// 相册幻灯片显示
function lLoopRun(sFuncLoop,sFuncEnd,nDelay) {
//writen by http://fengyan.iecn.cn
//sFuncLoop >> 字符串型，需要重复执行的Javascript函数或语句（多个函数或语句请用;分隔）  
//sFuncEnd >> 字符串型，用于中止重复执行动作（sFuncLoop）的Javascript函数或语句 
//nDelay >> 数字型，重复执行的时间间隔（毫秒数） 
 var vintervalId = null;
 var runString  = sFuncLoop;
 var stopString  = sFuncEnd;
 var delayTime  = nDelay;
 //var nCount = 0;//执行次数//为便于测试，应用时就将此行注释掉
 this._doLoop = function (){
   if (vintervalId && !eval(stopString)){
     eval(runString);
     //nCount++;//记录执行次数//为便于测试，应用时就将此行注释掉
   } else {
     window.clearInterval(vintervalId);
     vintervalId = null;
   }
   //document.getElementById("TestCount").innerHTML = nCount;//输出执行次数//为便于测试，应用时就将此行注释掉
 }
 window.clearInterval(vintervalId);
 vintervalId = window.setInterval(this._doLoop,delayTime);
}
function copy_tag()
{
	  document.form_tag.tag1.select();
	  window.clipboardData.setData('Text', document.form_tag.tag1.value);
	  alert("地址已经成功复制，您可以发送给好友或者收藏");
}

//地图切换
function ChangMap(sStoreId,sType)
{
	var t = new Date();
	if(sType==2)
	{
		$("#mapLoadingDiv").css("display", "none");
		$("#mapFrame").attr("src", "map.php?sid="+sStoreId+"&type=small&t="+t.toString());
		$("#mapFrame").css("display", "block");
	}
	else
	{
		$("#mapLoadingDiv").css("display", "none");
		$("#mapFrame").attr("src", "map.php?sid="+sStoreId+"&type=big&t="+t.toString());
		$("#mapFrame").css("display", "block");
	}
	/*
	 	$("#mapLoadingDiv").css("display", "none");
		$("#mapFrame").attr("src", "mic_map.php?sid="+sStoreId+"&type=big&t="+t.toString());
		$("#mapFrame").css("display", "block");
	 * */
}
